//
//  GuiderListCell.m
//  ImGuider
//
//  Created by 王鹏宇 on 2017/4/19.
//  Copyright © 2017年 imguider. All rights reserved.
//

#import "GuiderListCell.h"
#import "GuiderIconView.h"
@interface GuiderListCell()

@property (weak, nonatomic) IBOutlet GuiderIconView *guiderHeaderView;

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (weak, nonatomic) IBOutlet UILabel *guiderIntroduceLabel;

@property (weak, nonatomic) IBOutlet UILabel *viewCountLabel;

@property (weak, nonatomic) IBOutlet UILabel *visitCountLabel;

@property (weak, nonatomic) IBOutlet UILabel *faourCountLabel;

@property (weak, nonatomic) IBOutlet UILabel *guiderTagLabel;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *AuthenticationLabelH;

@end

@implementation GuiderListCell

- (void)awakeFromNib {
    [super awakeFromNib];
   
    self.nameLabel.textColor = kTitleColor;
    self.guiderTagLabel.textColor = kThemeRedColor;
}

-(void)setFrame:(CGRect)frame
{
    frame.size.height -= 20;
    [super setFrame:frame];
}

- (void)configDataWithGuiderModel:(GuiderCardModel *)model {
    
    self.guiderHeaderView.headerImageName = model.headimg;
    self.guiderHeaderView.vip = model.vip;
    self.nameLabel.text = model.realname; 
    
    self.viewCountLabel.text = [NSString stringWithFormat:@"%@",model.viewcount];
    self.visitCountLabel.text = [NSString stringWithFormat:@"%@",model.visitcount];
    self.faourCountLabel.text = [NSString stringWithFormat:@"%@",model.favourcount];
    
    if (model.certificate.length) {
        self.AuthenticationLabelH.constant = 20;
        self.guiderTagLabel.text = model.certificate;
    }else {
        self.guiderTagLabel.text = @"";
        self.AuthenticationLabelH.constant = 0;
    }

    if (model.introduction.length > 0) {
        self.guiderIntroduceLabel.attributedText = [IGUtils attributedStringText:model.introduction font:Font(10) color:kContentColor lineSpacing:lineSpace];;
    }else {
        self.guiderIntroduceLabel.text = @"";
    }
}
@end
